﻿@model XPressify.Models.StatusListModel
@using XPressify.Data.Helpers
@using XPressify.Models
@using Omu.Awesome.Core;
@using Omu.Awesome.Mvc.Helpers;

@if(Model.IsAjaxRequest)
{
    ViewBag.Title = "Status list";
}
else
{
    ViewBag.Title = "Status list";
    Layout = "~/Views/Shared/_Layout.cshtml";
}


<h2 style="color:#222">Status list</h2>

@Html.Confirm("Are you sure you want to delete this post?", "myconfirmBtn", title: "Delete post", yesText: "Delete")
@Html.Confirm("Are you sure you want to delete this comment?", "myconfirmBtn1", title: "Delete comment", yesText: "Delete")
<div id="returnSuccessDelete"></div>
<div id="specialPeopleLikeList" style="display:none"></div>  

@{var index = 0;
  var specialUpdateId = "";
  foreach (var item in Model.Posts)
  {
      <div id="@item.Key.Id">
        <table border="0" cellpadding="0" cellspacing="0" style="margin:0px;padding:0px;width:553px">
            <tr>
                <th style="padding: 0px 2px 0px 2px"> 
                    @Html.Raw(item.Key.Content)
                </th >
                @if (item.Key.BaseSubject.Id == Model.CurrentUserId)
                {
                    <td style="padding: 0px 2px 0px 2px;vertical-align:top;background-color: #E8EEF4;text-align:right">
                        @Html.Partial("BtnPostDelete", new BtnPostDeleteModel { PostId = item.Key.Id })
                    </td>
                }
            </tr>
        </table>
   
        @foreach (var comment in item.Value)
        {   
            <div id="@comment.Id">
                <table border="0" cellpadding="0" cellspacing="0" style="margin:0px;padding:0px;width:553px">
                    <tr>
                        <th width="0px" style="padding: 0px 2px 0px 2px"> 
                            @Html.Raw(comment.Content)
                        </th>
                        @if (comment.BaseSubject.Id == Model.CurrentUserId || comment.BaseObject.BaseSubject.Id == Model.CurrentUserId)
                        {
                            <th style="padding: 0px 2px 0px 2px;vertical-align: top;text-align:right"> 
                                @Html.Partial("BtnPostCommentDelete", new BtnPostDeleteModel { PostId = comment.Id })
                            </th>
                        }
                    </tr>
                </table>
            </div>
        }

        @{specialUpdateId = item.Key.Id + "Update";}
        <div id="@specialUpdateId"></div>
        
        @if (item.Key.Type != BaseMessageType.PostWithoutComments)
        {
            @Html.Partial("WriteComment", new XPressify.Models.PostCommentModel { PostId = item.Key.Id, ContentText = "Write a comment...", ProfilePicturePath = Model.ViewerProfilePicturePath })
        }
        ______________________________________________________________________________
    
    </div>
  }

}
